var t = require;
var e = module;
var o = exports;
var n =
        (this && this.__extends) ||
        (function () {
            var t = function (e, o) {
                return (t =
                    Object.setPrototypeOf ||
                    ({__proto__: []} instanceof Array &&
                        function (t, e) {
                            t.__proto__ = e;
                        }) ||
                    function (t, e) {
                        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                    })(e, o);
            };
            return function (e, o) {
                function n() {
                    this.constructor = e;
                }
                t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
            };
        })(),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var r,
                a = arguments.length,
                i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
            return a > 3 && i && Object.defineProperty(e, o, i), i;
        },
    a =
        (this && this.__awaiter) ||
        function (t, e, o, n) {
            function r(t) {
                return t instanceof o
                    ? t
                    : new o(function (e) {
                          e(t);
                      });
            }
            return new (o || (o = Promise))(function (o, a) {
                function i(t) {
                    try {
                        c(n.next(t));
                    } catch (t) {
                        a(t);
                    }
                }
                function s(t) {
                    try {
                        c(n.throw(t));
                    } catch (t) {
                        a(t);
                    }
                }
                function c(t) {
                    t.done ? o(t.value) : r(t.value).then(i, s);
                }
                c((n = n.apply(t, e || [])).next());
            });
        },
    i =
        (this && this.__generator) ||
        function (t, e) {
            var o,
                n,
                r,
                a,
                i = {
                    label: 0,
                    sent: function () {
                        if (1 & r[0]) throw r[1];
                        return r[1];
                    },
                    trys: [],
                    ops: []
                };
            return (
                (a = {next: s(0), throw: s(1), return: s(2)}),
                "function" == typeof Symbol &&
                    (a[Symbol.iterator] = function () {
                        return this;
                    }),
                a
            );
            function s(t) {
                return function (e) {
                    return c([t, e]);
                };
            }
            function c(a) {
                if (o) throw new TypeError("Generator is already executing.");
                for (; i; )
                    try {
                        if (
                            ((o = 1),
                            n &&
                                (r =
                                    2 & a[0]
                                        ? n.return
                                        : a[0]
                                        ? n.throw || ((r = n.return) && r.call(n), 0)
                                        : n.next) &&
                                !(r = r.call(n, a[1])).done)
                        )
                            return r;
                        switch (((n = 0), r && (a = [2 & a[0], r.value]), a[0])) {
                            case 0:
                            case 1:
                                r = a;
                                break;
                            case 4:
                                return i.label++, {value: a[1], done: !1};
                            case 5:
                                i.label++, (n = a[1]), (a = [0]);
                                continue;
                            case 7:
                                (a = i.ops.pop()), i.trys.pop();
                                continue;
                            default:
                                if (!(r = (r = i.trys).length > 0 && r[r.length - 1]) && (6 === a[0] || 2 === a[0])) {
                                    i = 0;
                                    continue;
                                }
                                if (3 === a[0] && (!r || (a[1] > r[0] && a[1] < r[3]))) {
                                    i.label = a[1];
                                    break;
                                }
                                if (6 === a[0] && i.label < r[1]) {
                                    (i.label = r[1]), (r = a);
                                    break;
                                }
                                if (r && i.label < r[2]) {
                                    (i.label = r[2]), i.ops.push(a);
                                    break;
                                }
                                r[2] && i.ops.pop(), i.trys.pop();
                                continue;
                        }
                        a = e.call(t, i);
                    } catch (t) {
                        (a = [6, t]), (n = 0);
                    } finally {
                        o = r = 0;
                    }
                if (5 & a[0]) throw a[1];
                return {value: a[0] ? a[1] : void 0, done: !0};
            }
        };
Object.defineProperty(o, "__esModule", {value: !0});
var s = t("Loading"),
    c = t("GameData"),
    l = t("View"),
    u = t("LoadingInfos"),
    p = t("OpenDataContexts"),
    f = t("Platforms"),
    d = t("Prefabs"),
    h = t("Const"),
    y = t("mainView"),
    g = cc._decorator,
    v = g.ccclass,
    m =
        (g.property,
        (function (t) {
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                return (e.res = "Load"), e;
            }
            var o;
            return (
                n(e, t),
                (o = e),
                (e.prototype.onEnable = function () {
                    this.平台代码初始化();
                }),
                (e.prototype.平台代码初始化 = function () {
                    var t = this,
                        e = cc.Canvas.instance.node.parent.getChildByName("loading").getComponent(s.default);
                    e.node.setSiblingIndex(0),
                        (e.node.name = "Load"),
                        f.default.init(
                            this.node.parent.getChildByName("platforms"),
                            e.node.getChildByName("gameHints"),
                            e.node.getChildByName("companyNames"),
                            e.node.getChildByName("warnings"),
                            e,
                            -320,
                            20,
                            "战斗",
                            "sounds",
                            function () {
                                return a(t, void 0, void 0, function () {
                                    var t,
                                        n = this;
                                    return i(this, function (r) {
                                        switch (r.label) {
                                            case 0:
                                                return [
                                                    4,
                                                    f.default.loadDirsAndGetAssetsByPath("prefab", cc.Prefab, d.prefabs)
                                                ];
                                            case 1:
                                                return (
                                                    r.sent(),
                                                    (t = o),
                                                    [4, f.default.loadDirsAndGetAssetsByPath("spine", sp.SkeletonData)]
                                                );
                                            case 2:
                                                return (
                                                    (t.skeletonDatas = r.sent()),
                                                    c.default.onInit(this, function () {
                                                        e.complete(function () {
                                                            e.node.destroy(),
                                                                u.default.done(),
                                                                f.default.进入游戏(function () {
                                                                    n.hideView(), n.showView(y.default);
                                                                });
                                                        });
                                                    }),
                                                    [2]
                                                );
                                        }
                                    });
                                });
                            },
                            null
                        ),
                        f.default.platformCtrl.使用开放域 &&
                            p.default.init(null, "getFriendCloudStorage", "getPotentialFriendList"),
                        (this.node.width = h.default.swid),
                        (this.node.height = h.default.shei + f.default.纵向安全边距),
                        (this.node.y -= f.default.纵向安全边距 / 2);
                }),
                (e = o = r([v], e))
            );
        })(l.default));
o.default = m;
